package org.dromara.wms.domain;

import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import org.dromara.common.tenant.core.TenantEntity;

import java.io.Serial;
import java.util.List;

/**
 * 跟物品有关的订单对象 wms_order
 *
 * @author wenrui
 * @date 2024-03-21
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("wms_order")
public class WmsOrder extends TenantEntity {

  @Serial
  private static final long serialVersionUID = 1L;

  @NotNull(message = "库单ID不能为空", groups = {EditGroup.class})
  @TableId(value = "id")
  private Long id;

  @NotBlank(message = "单据名称不能为空", groups = {AddGroup.class, EditGroup.class})
  @ExcelProperty(value = "单据名称")
  private String name;

  @NotNull(message = "单据类型不能为空", groups = {AddGroup.class, EditGroup.class})
  @ExcelProperty(value = "单据类型")
  private Long typeId;

  @ExcelProperty(value = "客户")
  private Long partnerId;

  @ExcelProperty(value = "己方仓库id")
  private Long selfWhId;

  @ExcelProperty(value = "对方仓库id")
  private Long otherWhId;

  @ExcelProperty(value = "单据状态", converter = ExcelDictConvert.class)
  @ExcelDictFormat(dictType = "wms_order_status")
  private String status;

  @ExcelProperty(value = "退回ID")
  private Long backId;

  @ExcelProperty(value = "来源id")
  private Long sourceId;

  @ExcelProperty(value = "生产厂商")
  private Long manufacturerId;

  @ExcelProperty(value = "申请人")
  private Long applicantId;

  @ExcelProperty(value = "发货员")
  private Long execId;

  @ExcelProperty(value = "备注")
  private String remark;

  @ExcelProperty(value = "收款账户")
  private Long fmsAccount;

  //  ====================================其他====================

  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  @TableField(exist = false)
  private String typeName;

  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  @TableField(exist = false)
  private String typePage;

  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  @TableField(exist = false)
  private String wmsType;

  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  @TableField(exist = false)
  private String fmsType;

  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  @TableField(exist = false)
  private String partnerName;

  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  @TableField(exist = false)
  private Double totalMoney;

  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  @TableField(exist = false)
  private Double discountMoney;

  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  @TableField(exist = false)
  private Double costMoney;

  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  @TableField(exist = false)
  private List<WmsOrderLine> line;

  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  @TableField(exist = false)
  private String warehouseName;

}
